package com.fangmao.jetpack.room;

import android.app.Application;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

/**
 * @ProjectName: wman
 * @Package: com.fangmao.jetpack.room
 * @ClassName: WordViewModel
 * @Description: java类作用描述
 * @Author: wman
 * @CreateDate: 2020/1/7 17:13
 * @UpdateUser: 更新者
 * @UpdateDate: 2020/1/7 17:13
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class WordViewModel extends AndroidViewModel {
    private WordRepo mWordRepo;

    public WordViewModel(@NonNull Application application) {
        super(application);
        mWordRepo = new WordRepo(application);
    }

    public LiveData<List<Word>> getAllWordLive() {
        return mWordRepo.getAllWordLive();
    }

    public void insertWord(Word... words) {
        mWordRepo.insertWord(words);
    }

    public void updateWord(Word... words) {
        mWordRepo.updateWord(words);
    }

    public void deleteWord(Word... words) {
        mWordRepo.deleteWord(words);
    }

    public void clearWord() {
        mWordRepo.clearWord();
    }
}
